/**
 * SEVAS - Swiss Electronic Vaccination Advisor Service / Agile Development
 *
 * $Id: Application.java 29 2010-08-18 16:51:14Z zimmr7@bfh.ch $
 */
package ch.bfh.sevas.gui;

import ch.bfh.sevas.Controller;
import ch.bfh.sevas.Initializer;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdesktop.application.SingleFrameApplication;

public class ElectronicVaccinationCard extends SingleFrameApplication {

    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        try {
            Long id = Initializer.initSEVAS();
            Controller controller = new Controller();
            show(new VaccinationCardView(this, controller, id));
        } catch (Exception ex) {
            Logger.getLogger(ElectronicVaccinationCard.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of ElectronicVaccinationCard
     */
    public static ElectronicVaccinationCard getApplication() {
        return ElectronicVaccinationCard.getInstance(ElectronicVaccinationCard.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(ElectronicVaccinationCard.class, args);
    }
}
